﻿<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="~/Content/form-style.css" />
    <link rel="stylesheet" href="~/Content/chatroomsStyles.css" />
    <script src="../../Scripts/jquery-1.6.2.js" type="text/javascript"></script>
    <script src="../../Scripts/website.js" type="text/javascript"></script>
    <title>Just Chat</title>
</head>
<body>
    <div id="wraper">
        <header>
        	<h2>JustChat (Logged as @Session["User"])</h2>
        </header>
        <section id="roomsList">
        	<header id="roomsListHeader">
            	Available rooms:
            </header>
            @foreach (SimpleChatDal.ChatRoom chatRoom in ViewBag.ChatRomsList)
            {
                <button class="roomFromList" id="@chatRoom.ChatRoomID" >@chatRoom.ChatRoomName</button>
            }
        </section>
        <section id="openedRooms">
            @foreach (SimpleChatDal.ChatRoom openedChatRoom in ViewBag.OpenedChatRooms)
            {
        	    <form class="form" action="~/ChatRooms/PostMessage" method="post">
	                <header class="formHeader">
                        <div class="formTitle">
                            @openedChatRoom.ChatRoomName
                        </div>
                        <a class="closeButton" href="~/ChatRooms/RemoveChatWindow?chatRoomId=@openedChatRoom.ChatRoomID">&nbsp;</a>
                    </header>
                    <section class="formBody">
                	    @foreach (SimpleChatDal.Message message in openedChatRoom.Messages.ToList())
                        {
                            <div>@message.MessageDate.ToShortTimeString() @message.Author : @message.MessageText </div>
                        }
                    </section>
                    <section class="submit">
                        <input type="hidden" name="chatRoomId" value="@openedChatRoom.ChatRoomID" />
                	    <input type="text" name="message" class="formTextbox" />
                        <input class="formSubmitButton" type="submit" value="send" />
                    </section>
                </form>
            }
        </section>
    </div>
</body>
</html>
